<?php

namespace App\Traits\Relation;

use App\Models\Project;
use App\Models\Station\Timing;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

trait StationRelation
{
	/**
	 * 获取岗点关联的项目信息
	 *
	 * Date: 30/04/2018
	 * @author George
	 * @return BelongsTo
	 */
	public function project()
	{
		return $this->belongsTo(Project::class, 'project_id', 'id');
	}

	/**
	 * 获取岗点的报岗时间信息
	 *
	 * Date: 01/05/2018
	 * @author George
	 * @return HasMany
	 */
	public function schedules()
	{
		return $this->hasMany(Timing::class, 'station_id', 'id');
	}
}
